package design_pattern.singleton;

/**
 * @Author pc
 * @Date 2019/8/23 16:08
 * @Description 静态内部类单例，保证线程安全，实现延迟加载
 */
public class StaticInnerClassSingleton {
    private StaticInnerClassSingleton(){
        System.out.println("初始化");
    }
    public static StaticInnerClassSingleton getInstance(){
        return Singleton.instance;
    }

    public static class Singleton{//静态内部类实现单例
        private static StaticInnerClassSingleton instance = new StaticInnerClassSingleton();
    }
}
